<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Ant Design Mobile | A Mobile Design Specification</title>
    <link rel="icon" href="https://zos.alipayobjects.com/rmsportal/wIjMDnsrDoPPcIV.png" type="image/x-icon">
    {% if not isDev %}
    <link rel="stylesheet" type="text/css" href="{{ root }}index-1.css"/>
    <link rel="stylesheet" type="text/css" href="{{ root }}index-2.css"/>
    {% endif %}
    <!--[if lte IE 10]>
    <script src="https://as.alipayobjects.com/g/component/??console-polyfill/0.2.2/index.js,es5-shim/4.5.7/es5-shim.min.js,es5-shim/4.5.7/es5-sham.min.js,html5shiv/3.7.2/html5shiv.min.js,media-match/2.0.2/media.match.min.js"></script>
    <![endif]-->
    <script>
      if (!window.Intl) {
        document.writeln('<script src="https://as.alipayobjects.com/g/component/intl/1.0.1/??Intl.js,locale-data/jsonp/en.js,locale-data/jsonp/zh.js">' + '<' + '/script>');
      }
      if(!window.Promise) {
        document.writeln('<script src="https://as.alipayobjects.com/g/component/es6-promise/3.2.2/es6-promise.min.js"'+'>'+'<'+'/'+'script>');
      }
      // Enable Google Analytics
      if (!location.port) {
        /* eslint-disable */
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
        ga('create', 'UA-72788897-2', 'auto');
        ga('send', 'pageview');
        /* eslint-enable */
      }
     (function() {
        function checkIfMobile() {
          var ua = window.navigator.userAgent.toLowerCase();
          if (ua.indexOf('android') !== -1 || ua.indexOf('iphone') !== -1) {
            return true;
          }
          return false;
        }
        function checkIfCn() {
          return window.navigator.language.toLowerCase() === 'zh-cn'; // wtf safari is 'zh-CN', while chrome and other is 'zh-CN'
        }
        if (checkIfMobile()) {
          var url = location.port ? 'http://127.0.0.1:8002/' : window.location.origin + '/kitchen-sink/';
          if (checkIfCn()) {
            url = url + '?lang=zh-CN';
          } else {
            url = url + '?lang=en-US';
          }
          return location.href = url;
        }
        function isLocalStorageNameSupported() {
          const testKey = 'test';
          const storage = window.localStorage;
          try {
            storage.setItem(testKey, '1');
            storage.removeItem(testKey);
            return true;
          } catch (error) {
            return false;
          }
        }
        // 优先级提高到所有静态资源的前面，语言不对，加载其他静态资源没意义
        var pathname = location.pathname;
        function isZhCN(pathname) {
          return /-cn\/?$/.test(pathname);
        }
        function getLocalizedPathname(path, zhCN) {
          var pathname = path.startsWith('/') ? path : '/' + path;
          if (!zhCN) { // to enUS
            return /\/?index-cn/.test(pathname) ? '/' : pathname.replace('-cn', '');
          } else if (pathname === '/') {
            return '/index-cn';
          } else if (pathname.endsWith('/')) {
            return pathname.replace(/\/$/, '-cn/');
          }
          return pathname + '-cn';
        }
        // 首页无视链接里面的语言设置 https://github.com/ant-design/ant-design/issues/4552
        if (isLocalStorageNameSupported() && (pathname === '/' || pathname === '/index-cn')) {
          var lang = (window.localStorage && localStorage.getItem('locale')) || (window.navigator.language.toLowerCase() === 'zh-cn' ? 'zh-CN' : 'en-US');
          if ((lang === 'zh-CN') !== isZhCN(pathname)) {
            location.pathname = getLocalizedPathname(pathname, lang === 'zh-CN');
          }
        }
        document.documentElement.className += isZhCN(pathname) ? 'zh-cn' : 'en-us';
      })()
    </script>
    <!-- Hotjar Tracking Code for mobile.ant.design -->
    <!-- <script>
        (function(h,o,t,j,a,r){
            h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
            h._hjSettings={hjid:475793,hjsv:5};
            a=o.getElementsByTagName('head')[0];
            r=o.createElement('script');r.async=1;
            r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
            a.appendChild(r);
        })(window,document,'//static.hotjar.com/c/hotjar-','.js?sv=');
    </script> -->
  </head>
  <body>
    <div id="react-content"></div>
    {% if isDev %}
    {% else %}
      {% if useReact %}
        <script src="https://as.alipayobjects.com/g/component/??react/15.6.1/react.min.js,react/15.6.1/react-dom.min.js"></script>
      {% else %}
      {% endif %}
      <!-- react-router@3.0.5 -->
      <script src="https://gw.alipayobjects.com/os/rmsportal/cazbJtoQZXZDNurlPtJd.js"></script>
    {% endif %}
    <!-- history@3.2.1 -->
    <script src="https://os.alipayobjects.com/rmsportal/VnttsLkEQmyLDBBluBQq.js"></script>
    <!-- babel-polyfill@6.20.0 -->
    <script src="https://os.alipayobjects.com/rmsportal/wzWaWInUcXErDyTwvySY.js"></script>
    <script src="{{ root }}common.js"></script>
    <script src="{{ root }}index.js"></script>
  </body>
</html>
